/**
 * 
 */
package com.nextive.interview.dao;

import android.database.Cursor;


/**
 * Dao interface to obtain information related to weight histories. 
 * @author Cesar Roman
 *
 */
public interface WeightInfoDao {
	
	// weight history database constants
	String ID_KEY = "_id";
	String WEIGHT_KEY = "weight";
	String DATE_KEY = "date";
	int ALL_RESULTS = -1;
	
	/**
	 * It fetches weight history info. It returns as many results as specified by parameter.
	 * @param maxResults if equals to <code>-1</code> then it returns all results
	 * @return cursor containing the query result
	 */
	Cursor fetchWeightHistoriesInfo(int maxResults);
	
	/**
	 * It fetches a single weight history info matching given id.
	 * @param id to look history for
	 * @return cursor containing the query result
	 */
	Cursor fetchWeightHistoryInfo(long id);
	
	/**
	 * It fetches weight history info since a given date. It matches all 
	 * timestamps greater or equal than given timestamp.
	 * @param timestamp to fetch history since
	 * @return cursor containing the query result
	 */
	Cursor fetchWeightHistoryInfoSince(long timestamp);
	
	/**
	 * It deletes a weight history info matching given id.
	 * @param id to delete history
	 * @return true if deleted successfully
	 */
	boolean deleteWeightInfo(long id);
	
	/**
	 * It creates a new weight info entry.
	 * @param weight new weight to be added
	 * @param dateMillis new date to be added
	 * @return id the row id of the newly record
	 */
	long createNewWeightInfo(Double weight, long dateMillis);
	
	/**
	 * It updates an existing weight history info.
	 * @param id the row id of the record to update
	 * @param weight new weight to be updated
	 * @param dateMillis new date to be updated
	 * @return the number of rows affected
	 */
	boolean updateWeightInfo(long id, Double weight, long dateMillis);

}